package com.guaoran.newsdata.api.hystrix;

import com.guaoran.newsdata.api.domain.News;
import com.guaoran.newsdata.api.service.NewsDataCoreService;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @Author gucheng
 * @Description 使用 Feign 调用 {@link NewsDataCoreService} 失败后使用 Hystrix 熔断
 * 2019-07-19 13:12
 */
@Component
public class NewsDataCoreServiceFallback implements NewsDataCoreService {
    @Override
    public boolean save(News news) {
        return false;
    }

    @Override
    public boolean update(News news) {
        return false;
    }

    @Override
    public boolean delete(Long id) {
        return false;
    }

    @Override
    public Collection<News> findAll() {
        return new ArrayList<News>();
    }

    @Override
    public News findById(Long id) {
        return new News(0L,"标题","内容很丰富...");
    }
}
